<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <div class="left">
        <a href="#{request.contextPath}/faces/user/index.xhtml"><img src="#{request.contextPath}/resources/images/logo.jpg" alt="logo" /></a>
    </div>
    <div class="right">
        <c:if test='#{baseBean.authenticatedUser.roleName == "ADMIN"}'>
            <div class="admin-shortcuts">
                <ul>
                    <li><a href="#{request.contextPath}/faces/admin/taskAdd.xhtml">New task</a></li>
                    <li><a href="#{request.contextPath}/faces/admin/taskList.xhtml">View all tasks</a></li>
                    <li><a href="#{request.contextPath}/faces/admin/userList.xhtml">Manage users</a></li>
                </ul>
            </div>
        </c:if>
        <div class="navigation">
            <form>
                <select id="task-shortcut">
                    <option>Pick a task</option>
                    <ui:repeat var="t" value="#{taskBean.ongoing}">
                        <option value="#{t.id}">#{t.title}</option>
                    </ui:repeat>
                </select>
            </form>
            <div>
                <span id="current-date">Notification#{taskBean.tasksWithNotifications.size()>1?"s":""}</span>
                <div id="notifications" class=" zero"><span>#{taskBean.tasksWithNotifications.size()}</span>
                    <div>
                        <c:choose>
                            <c:when test="#{taskBean.tasksWithNotifications.size() > 0}">
                                <ul class="task-list">
                                    <ui:repeat var="t" value="#{taskBean.tasksWithNotifications}">
                                        <li>
                                            <input type="hidden" value="#{t.id}" />
                                            <span class="no-overflow">#{t.title}</span>
                                        </li>
                                    </ui:repeat>
                                </ul>
                            </c:when>
                            <c:otherwise>
                                <p>It looks like you are <span>up to date!</span></p>
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
            </div>
        </div>
        <div class="profile">
            <div class="user-name">
                <!--<a href="#{request.contextPath}/faces/user/profile.xhtml?editPicture=true"><img src="" alt=""/></a>
                <a href="#{request.contextPath}/faces/user/profile.xhtml">#{userBean.authenticatedUser.firstname} #{userBean.authenticatedUser.lastname}</a>-->
                <a href="#"><img src="" alt=""/></a>
                <a href="#">#{userBean.authenticatedUser.firstname} #{userBean.authenticatedUser.lastname}</a>
            </div>
            <div class="logout">
                <a href="#{request.contextPath}/faces/logout.xhtml?reason=logout">Sign out</a>
            </div>
        </div>
    </div>
</html>